function [Tn, cv] = obj_fy_as10_corr(para, profit_ub, ...
    profit_lb, data_outcome, ....
    g_ar, N_mkt, rand_seed, tau_reps, sig_level, ...
    correlated_fc, data_outcome2, N_dev2, corr_sim, ...
    dev2_ind_f1_tr, dev2_ind_f2_tr, corr_g_ar)
% AS test statistic and critical value

if correlated_fc
    prob_lb = normcdf((profit_lb - para(1) - corr_sim*para(3))/para(2)); % N*N_mkt x N_corr_sim
    prob_ub = normcdf((profit_ub - para(1) - corr_sim*para(3))/para(2));
else
    prob_lb = normcdf((profit_lb - para(1))/para(2)); % N_mkt x 1
    prob_ub = normcdf((profit_ub - para(1))/para(2));
end
clear profit_lb profit_ub;

% the moment conditions
% m<=0
if correlated_fc
    m = [mean(prob_lb - data_outcome, 2), mean(data_outcome - prob_ub, 2)]; % N_mkt*N x 2
else
    m = [prob_lb - data_outcome, data_outcome - prob_ub]; % N_mkt*N x 2
end

if correlated_fc
    prob_lb2 = mean(prob_lb(dev2_ind_f1_tr, :).*prob_lb(dev2_ind_f2_tr, :), 2);
    prob_ub2 = mean(prob_ub(dev2_ind_f1_tr, :) .*prob_ub(dev2_ind_f2_tr, :), 2);
    corr_m = [prob_lb2 - data_outcome2, data_outcome2 - prob_ub2];
else
    corr_m = [];
end
clear prob_ub2 prob_lb2

% AS test statistic and critical value
[Tn, cv] = as10_test_corr(m, g_ar, N_mkt, rand_seed, tau_reps, sig_level, ...
    correlated_fc, N_dev2, corr_m, corr_g_ar);













